import http from "./request"

// 登录接口
export const loginApi = async params => {
    return await http.post('/api/login', params)
}

// 退出接口
export const logoutApi = async () => {
    return await http.get('/api/login/logout', null)
}

// 获取用户信息
export const getUserInfoApi = async params => {
    return await http.get('/api/login/getInfo', params)
}

// 更新用户信息
export const updateInfoApi = async params => {
    return await http.put('/api/login/updateInfo', params)
}

// 获取菜单
export const getMenuListApi = async params => {
    return await http.get('/api/login/getMenuList', params)
}

// 获取用户列表
export const getListApi = async (params) => {
    return await http.get('/api/user/list', params)
}

// 新增用户
export const addUserApi = async (params) => {
    return await http.post('/api/user', params)
}

// 编辑用户
export const editUserApi = async (params) => {
    return await http.put('/api/user', params)
}

// 删除用户
export const deleteUserApi = async (params) => {
    return await http.delete('/api/user', params)
}

// 角色列表
export const getRoleListApi = async (params) => {
    return await http.get('/api/user/roleList', params)
}

// 通过用户的id获取用户对应的角色
export const getUserRoleApi = async (params) => {
    return await http.get('/api/user/getRoleByUserId', params)
}

// 获取所有的角色信息
export const getRoleTypesApi = async () => {
    return await http.get('/api/login/roleTypes')
}